Readme


AU program: au_if_nus_3c
This needs to be copied to <TSHOME>\exp\stan\nmr\au\src\user
e.g. C:\Bruker\TopSpin4.0.7\exp\stan\nmr\au\src\user
The AU program handles processing of the 1D proton spectrum, runs the Python program, and then configures the NUS parameters correctly.

The Python program: sampling_simulator3b.py
Copy to the default location: C:/Python27/Scripts/sampling_simulator3b.py
However, can be put anywhere as long as you change the header in the AU program.

The Prosol definitions file: TSE_PSYCHE
This needs to be copied to <TSHOME>\conf\instr\spect\prosol\puleassign
This modified version was needed for compatibility with our instrument. If you wish to use the defaults for getprosol delete the line "prosol relations=<TSE_PSYCHE>"


Configuring your Python environment:
The Python script above uses the scipy and numpy libraries, which are only available for the C-version of Python.
The version of Python that is packaged with TopSpin is Java-based ("Jython"), so cannot be used for this script.
We therefore have to install an external environment to get allow this to run.
The script was written to be compatible with Python 2, but can readily be made 3-compatible by modifying the syntax for the print statements.
The numpy and scipy libaries are not included in the standard Python installation, so have to be installed somehow.

Attempts to get Python versions with pre-packaged numpy/scipy libraries were unsuccesful due to difficulties in getting TopSpin to correctly handle the Python environment.
In particular, we were unable to get this to work with Anaconda 2/3 or Python(x,y).
However, this does work with the standard Python installation (https://www.python.org/downloads/), and then installing the required numpy and scipy packages using pip.

If your spectrometer has internet access:
In Windows:
1. Install Python 2.7 with the defaults - there is no need to add it to the path.
2. Open a command prompt in C:/Python27/Scripts/
3. pip install numpy
4. pip install scipy

If your spectrometer does not have internet access, one can download the required packages on another system with a similar environment (i.e. same OS).
On your own PC with the same 32/64-bit and Windows/Linux environment:
1. Install Python 2.7 with the defaults
2. Open a command prompt in C:/Python27/Scripts/
3. pip download numpy
4. pip download scipy
5. Transfer the resulting .whl files over. At the time of writing for x64 Windows these were:
numpy-1.16.4-cp27-cp27m-win_amd64.whl
scipy-1.2.2-cp27-cp27m-win_amd64.whl

On-spectrometer:
1. Install Python 2.7 with the defaults
2. Move the two whl files over to C:/Python27/Scripts/
3. Open a command prompt in the same place.
4. pip install numpy-1.16.4-cp27-cp27m-win_amd64.whl
5. pip install scipy-1.2.2-cp27-cp27m-win_amd64.whl


Configuring TopSpin/IconNMR:
Acquisition;
The 1D proton dataset can be any sort of default parameters - these are not critical.

The interferogram pure shift experiment must be configured so that it can access the 1D proton preparation experiment.
This can be done manually with edc2, or by setting up the experiment as composite within IconNMR.
For automation, AUNM must be set to "au_if_nus_3c"

Note that the pulse program is very similar to the publicly available one from the from the University of Manchester website, but that the F1QF declaration was changed from F1QF(id0) to F1QF(caldel(d0, +in0)) so that it was NUS-compatible.


Processing:
The publicly available "pshift" AU program available from the University of Manchester website currently does not support sparse datasets. However, the library program "proc_reset" can be used provided that the status parameters of the dataset are set so that it appears as if it were a library "reset" pulse sequence. Namely, S L30 needs to be set as per CNST4 (dropped points), and S L31 to 2 SWH/1 SWH (number of points per chunk). These actions are included in the processing program "proc_reset_UoM".
